<?php
namespace OrderAdmin\Controller;
use Common\Service\AdminAuth;
use OrderAdmin\Model\ActivityModel;
use OrderAdmin\Model\AdminsModel;
use OrderAdmin\Model\OrderModel;
use OrderAdmin\Model\WorkerModel;
use Think\Auth;
use Think\PageAdmin;

/**
 * 师傅管理控制器
 */
class ActivityController extends BaseController
{

    /**
     * 初始化
     *
     * @return [type] [description]
     */
    public function _initialize()
    {
        parent::_initialize();
        $this->activityModel = new ActivityModel();
    }

    public function detail(){
        $id = I('get.id', 0, 'intval');
        if($id === 0){
            $this->error('客户不存在');
        }
        $data = $this->activityModel->getInfoById($id);
        $this->assign(compact('data', 'id'));
        $this->display();
    }

    /**
     * 删除活动
     */
    public function delete(){
        $id = I('post.id', 0, 'intval');
        if($id === 0){
            ajax_return(false, '活动不存在');
        }
        $data = $this->activityModel->deleteById($id);
        $data ? ajax_return(true, '删除成功') : ajax_return(false, '删除失败');
    }
}